import { Collection, Db, MongoClient, OptionalId } from "mongodb";
import { Logger } from "tsrpc";
// import { DbPost } from "../shared/db/DbPost";
import { BackConfig } from "./BackConfig";

export class Global {

    static db: Db;

    static async initDb(logger?: Logger) {
        logger?.log(`Start connecting db...`)
        const client = await new MongoClient(BackConfig.mongoDb).connect();
        logger?.log(`Db connected successfully...`)
        this.db = client.db();
    } 

}